# _author_ = liuxiaowen
# _date_ = 2021-09-12
# _desc_ = 找出所有的自恋数

"""
for number in range(100, 1000):
    sum_, number_ = 0, number
    weight = 10**2
    while weight >= 1:
        sum_ += (number_//weight)**3
        # 累加每位的三次秘
        weight //= 10
        # 权值降低一级变成10
        number_ %= weight
        # 取到下一位的位数
    else:
        if sum_ == number:
            print(number, end="")
"""

for number in range(100, 1000):
    sum_, number_ = 0, number
    while number_ > 0:
        sum_ += (number_ % 10)**3
        # number_%10通过取余获取个位上的数字！
        number_ //= 10
        # number_//10通过整除10消掉个位上的数字！
    else:
        if sum_ == number:
            print(number, end=" ")


# 获取个位数字则对10取余，去除掉个位数则整除10

